package cn.edu.xmu.restfuldemo.model.VO;

import cn.edu.xmu.restfuldemo.model.BO.Orders;
import cn.edu.xmu.restfuldemo.model.PO.OrdersPo;
import cn.edu.xmu.restfuldemo.model.VoObject;
import lombok.*;

import java.time.LocalDateTime;

/**
 * @author Team3-5
 */
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class OrdersVo implements VoObject {
    private Long id;
    private Long customerId;
    private Long shopId;
    private String orderSn;
    private Long pid;
    private String consignee;
    private Long regionId;
    private String address;
    private String mobile;
    private String message;
    private Byte orderType;
    private Long freightPrice;
    private Long couponId;
    private Long couponActivityId;
    private Long discountPrice;
    private Long originPrice;
    private Long presaleId;
    private Long grouponDiscount;
    private Integer rebateNum;
    private LocalDateTime confirmTime;
    private String shipmentSn;
    private Byte state;
    private Byte substate;
    private Byte beDeleted;
    private LocalDateTime gmtCreate;
    private LocalDateTime gmtModified;
    private Long grouponId;


    public OrdersVo(OrdersPo ordersPo){
        this.id = ordersPo.getId();
        this.customerId = ordersPo.getCustomerId();
        this.shopId = ordersPo.getShopId();
        this.orderSn = ordersPo.getOrderSn();
        this.pid = ordersPo.getPid();
        this.consignee = ordersPo.getConsignee();
        this.regionId = ordersPo.getRegionId();
        this.address = ordersPo.getAddress();
        this.mobile = ordersPo.getMobile();
        this.message = ordersPo.getMessage();
        this.orderType = ordersPo.getOrderType();
        this.freightPrice = ordersPo.getFreightPrice();
        this.couponId = ordersPo.getCouponId();
        this.couponActivityId = ordersPo.getCouponActivityId();
        this.discountPrice = ordersPo.getDiscountPrice();
        this.originPrice = ordersPo.getOriginPrice();
        this.presaleId = ordersPo.getPresaleId();
        this.grouponDiscount = ordersPo.getGrouponDiscount();
        this.rebateNum = ordersPo.getRebateNum();
        this.confirmTime = ordersPo.getConfirmTime();
        this.shipmentSn = ordersPo.getShipmentSn();
        this.state = ordersPo.getState();
        this.substate = ordersPo.getSubstate();
        this.beDeleted = ordersPo.getOrderType();
        this.gmtCreate = ordersPo.getGmtCreate();
        this.gmtModified = ordersPo.getGmtModified();
        this.grouponId = ordersPo.getGrouponId();
    }
    /**
     * ordersVo->orders
     * @return orders
     */
    public Orders newOrders(){
        Orders orders = new Orders();
        orders.setId(this.id);
        orders.setCustomerId(this.customerId);
        orders.setShopId(this.shopId);
        orders.setOrderSn(this.orderSn);
        orders.setPid(this.pid);
        orders.setConsignee(this.consignee);
        orders.setRegionId(this.regionId);
        orders.setAddress(this.address);
        orders.setMobile(this.mobile);
        orders.setMessage(this.message);
        orders.setOrderType(this.orderType);
        orders.setFreightPrice(this.freightPrice);
        orders.setCouponId(this.couponId);
        orders.setCouponActivityId(this.couponActivityId);
        orders.setDiscountPrice(this.discountPrice);
        orders.setOriginPrice(this.originPrice);
        orders.setPresaleId(this.presaleId);
        orders.setGrouponDiscount(this.grouponDiscount);
        orders.setRebateNum(this.rebateNum);
        orders.setConfirmTime(this.confirmTime);
        orders.setShipmentSn(this.shipmentSn);
        orders.setState(this.state);
        orders.setSubstate(this.substate);
        orders.setBeDeleted(this.beDeleted);
        orders.setGmtCreate(this.gmtCreate);
        orders.setGmtModified(this.gmtModified);
        orders.setGrouponId(this.grouponId);
        return orders;
    }

    @Override
    public Object createVo() {
        return this;
    }

    @Override
    public Object createSimpleVo() {
        return this;
    }
}
